import Aabb from "./aabb";
import BroadPhaseProxyCallback from "../broad-phase/broad-phase-proxy-callback";

export default class AabbTestWrapper extends BroadPhaseProxyCallback{
    constructor() {
        super();
        this._aabb = new Aabb();
        this._callback = null;
    }
    process(proxy) {
        let shape = proxy.userData;
        let se = shape._aabb.elements,ae=this._aabb.elements;
        if(se[0] < ae[3] && se[3] > ae[0] && se[1] < ae[4] && se[4] > ae[1] && se[2] < ae[5] && se[5] > ae[2]) {
            this._callback.process(shape);
        }
    }
}